From af1aba6a2556a1d8978b75713a8df74cec1ab955 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 14 Jul 2006 21:22:23 +0000 Subject: [PATCH] Unicsv: whack dead code. util.c: vaporize pointless pointer deref. holux.c: make date handling less wrong. (I think.) --- holux.c | 26 ++++++++++++++++++-------- unicsv.c | 14 -------------- util.c | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/holux.c b/holux.c index c63a02bd1..df475d6c9 100644 --- a/holux.c +++ b/holux.c @@ -125,15 +125,25 @@ static void data_read(void) wpt_tmp->creation_time = 0; if (pWptHxTmp->date.year) { +#if 0 + /* Unless there's some endian swapping that I don't see, + * this can't be right. Then again, the definition of the + * the structure itself has a pretty serious disregard for + * host word size issues... - rjl + */ ptm = gmtime((time_t*)&pWptHxTmp->time); - tm.tm_hour = ptm->tm_hour; - tm.tm_min = ptm->tm_min; - tm.tm_sec = ptm->tm_sec; - - tm.tm_mday = pWptHxTmp->date.day; - tm.tm_mon = pWptHxTmp->date.month - 1; - tm.tm_year = pWptHxTmp->date.year - 1900; - wpt_tmp->creation_time = mktime(&tm); +#else + time_t wt = le_read32(&pWptHxTmp->time); + ptm = gmtime(&wt); +#endif + tm.tm_hour = ptm->tm_hour; + tm.tm_min = ptm->tm_min; + tm.tm_sec = ptm->tm_sec; + + tm.tm_mday = pWptHxTmp->date.day; + tm.tm_mon = pWptHxTmp->date.month - 1; + tm.tm_year = pWptHxTmp->date.year - 1900; + wpt_tmp->creation_time = mktime(&tm); } lon = le_read32(&pWptHxTmp->pt.iLongitude) / 36000.0; diff --git a/unicsv.c b/unicsv.c index a5de55a4d..be72b2b73 100644 --- a/unicsv.c +++ b/unicsv.c @@ -54,20 +54,6 @@ arglist_t unicsv_args[] = { /* helpers */ -/* fread_buff: returns only left and right trimmed non-empty lines or NULL */ -static char * -fread_buff(textfile_t *tin) -{ - char *result; - - while ((result = textfile_read(tin))) - { - result = lrtrim(result); - if (*result != '\0') break; - } - return result; -} - #define UNICSV_IS(f) (0 == strcmp(s, f)) #define UNICSV_CONTAINS(f) (0 != strstr(s, f)) diff --git a/util.c b/util.c index 895dcfabc..b61a12cc0 100644 --- a/util.c +++ b/util.c @@ -1240,7 +1240,7 @@ strip_html(const utf_string *in) tag[0] = 0; } - *instr++; + instr++; } *out++ = 0; return (outstring); -- 2.30.2